package com.coinworld.consumer;

import com.coinworld.Handler.DiligenceHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class ListenDiligence {


    @Autowired
    private  DiligenceHandler diligenceHandler;
    @RabbitListener(queues = "diligenceUpdate")
    @RabbitHandler
    public void receive(Integer userId) {
        try{
            diligenceHandler.dealDiligenceUpdate(userId);
        }catch(Exception e){
            log.error("diligenceUpdate error ",e);
        }
    }

}
